// miniprogram/pages/home/home.js
wx.setNavigationBarTitle({
  title: '我的学生'
})
Page({

  /**
   * 页面的初始数据
   */
  data: {

    /*inputShowed: false,
        inputVal: "",*/
    userInfos: [{
        name: "吴小8",
        grade: "一年级",
        sex: "男",
        phone: "1385165489"
      },
      {
        name: "吴小华",
        grade: "二年级",
        sex: "女",
        phone: "16895874569"
      },
      {
        name: "吴小花",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小小",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小光",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小风",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小丁",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小妖",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小大",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小美",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小文",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小丫",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小真",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小圳",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小丑",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
      {
        name: "吴小",
        grade: "一年级",
        sex: "女",
        phone: "16854785698"
      },
    ],
  },


  /*
   *搜索
   */
  search: function (value) {
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve([{
          text: '搜索结果',
          value: 1
        }, {
          text: '搜索结果2',
          value: 2
        }])
      }, 200)
    })
  },
  selectResult: function (e) {
    console.log('select result', e.detail)
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      search: this.search.bind(this)
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  /**
   * 点击绑定的事件
   */
  clickMe: function (e) {
    var userInfo = e.currentTarget.dataset.item;

    //跳转
    wx.navigateTo({
      url: '/pages/redirect/redirect?name=' + userInfo.name + '&grade=' + userInfo.grade +
        '&sex=' + userInfo.sex + '&phone=' + userInfo.phone
    })
  }
});